package com.lagou.edu.demo.controlller;

import com.lagou.edu.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author fanbo@imoran.net
 * @date 2021/1/6 5:55
 */

@LagouController

@LagouRequestMapping("/security")
public class SecurityTestDemoController {

    @LagouAutowired
    private IDemoService demoService;

    @LagouRequestMapping("/test1")
    public String test1(HttpServletRequest request, HttpServletResponse response, String username) {
        return demoService.get(username);
    }

    @LagouSecurity({"zhangsan"})
    @LagouRequestMapping("/test2")
    public String test2(HttpServletRequest request, HttpServletResponse response, String username) {
        return demoService.get(username);
    }

    @LagouSecurity({"zhangsan", "lisi"})
    @LagouRequestMapping("/test3")
    public String test3(HttpServletRequest request, HttpServletResponse response, String username) {
        return demoService.get(username);
    }
}